package main

import (
	"github.com/gin-gonic/gin"
	"net/http"
	"./webUsers/userViews"
)

func main() {
	r := gin.Default()

	go r.GET("/", userViews.Login)

	users := r.Group("/accounts")
	{
		users.GET("/welcome", func(c *gin.Context) {
			firstname := c.DefaultQuery("firstname", "Guest")
			lastname := c.Query("lastname") // 是 c.Request.URL.Query().Get("lastname") 的简写
			c.String(http.StatusOK, "Hello %s %s", firstname, lastname)
		})
		go users.GET("/register", userViews.Register)
		go users.GET("/login", userViews.Login)
	}


	r.Run(":8080")
}
